Easy dxl question to make an attribute

I want to create a DXL attribute that has the object ID in it.

I have an attribute called requirement type which I wish to search for specific values and if those values exist then poplulate the attribute with the object ID (technically prefix + UID).

The following DXL use to work for me...but doesn't anymore. Can someone correct it for me?

Module m = current
Object obj = null

if ((obj."Requirement Type" "" == "Threshold") || (obj."Requirement Type" "" == "Objective") || (obj."Requirement Type" "" == "KPP"))

{
Buffer temp = create
probeRichAttr_(obj,"Object Identifier", temp, false)
temp += "\\pard "
obj.attrDXLName = richText (temp)
delete temp
}


 


branchwp - Fri Sep 19 15:37:26 EDT 2014

Re: Easy dxl question to make an attribute
Mike.Scharnow - Fri Sep 19 17:05:22 EDT 2014

Just remove the first two lines.

obj is predefined with the object that the attribute belongs to.

You don't need 'm' in this code. If you need it in some other context, you can set it with the command 'Module m = module obj'

Also, 'Object Identifier' will always exist, so there's no need to use 'probeRichAttr_'. It would be even better if you used the function 'identifier', then you don't need a buffer. So, the whole code should look like this:

 

if ((obj."Requirement Type" "" == "Threshold") || (obj."Requirement Type" "" == "Objective") || (obj."Requirement Type" "" == "KPP")) 
{
obj.attrDXLName = identifier obj
} 

 

Hope this helps,
Mike

Re: Easy dxl question to make an attribute
branchwp - Fri Sep 19 17:29:14 EDT 2014

Mike.Scharnow - Fri Sep 19 17:05:22 EDT 2014

Just remove the first two lines.

obj is predefined with the object that the attribute belongs to.

You don't need 'm' in this code. If you need it in some other context, you can set it with the command 'Module m = module obj'

Also, 'Object Identifier' will always exist, so there's no need to use 'probeRichAttr_'. It would be even better if you used the function 'identifier', then you don't need a buffer. So, the whole code should look like this:

 

if ((obj."Requirement Type" "" == "Threshold") || (obj."Requirement Type" "" == "Objective") || (obj."Requirement Type" "" == "KPP")) 
{
obj.attrDXLName = identifier obj
} 

 

Hope this helps,
Mike

Actually my code does not have the first two lines in it...I added those thinking they were how you start most dxls. It fails with a run time error apparently. I will try your simply solution though.

Pat